package com.software.base;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @BelongsProject: Second-hand-trading-platform
 * @BelongsPackage: com.software.base
 * @Author: wyj
 * @CreateTime: 2024-02-27  14:03
 * @Description:
 * @Version: 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultInfo {
    private int code;
    private String msg;
    private int total;
    private Object data;


    public static ResultInfo success() {
        ResultInfo resultInfo = new ResultInfo(200, "success", 0, null);
        return resultInfo;
    }
    public static ResultInfo success(int total, Object data) {
        ResultInfo resultInfo = new ResultInfo(200, "success", total, data);
        return resultInfo;
    }
    public static ResultInfo success( Object data) {
        ResultInfo resultInfo = new ResultInfo(200, "success", 0, data);
        return resultInfo;
    }



    public static ResultInfo success(String msg) {
        ResultInfo resultInfo = new ResultInfo(200, msg, 0, null);
        return resultInfo;
    }

    public static ResultInfo error(String msg) {
        ResultInfo resultInfo = new ResultInfo(500, msg, 0,null);
        return resultInfo;
    }


}
